<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>M&oacute;dulo Administrador</title>
        <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="">
        <meta name="author" content="">

        <link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>js/bootstrap/css/bootstrap.css">
        <link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>css/theme.css">
        <link rel="stylesheet" href="<?php echo base_url(); ?>js/font-awesome/css/font-awesome.css">

        <script src="<?php echo base_url(); ?>js/jquery-1.7.2.min.js" type="text/javascript"></script>

        <!-- Demo page code -->
        <style type="text/css">
            #line-chart {
                height:300px;
                width:800px;
                margin: 0px auto;
                margin-top: 1em;
            }
            .brand { font-family: georgia, serif; }
            .brand .first {
                color: #ccc;
                font-style: italic;
            }
            .brand .second {
                color: #fff;
                font-weight: bold;
            }
        </style>
    </head>

    <body class=""> 
        <div class="navbar">
            <div class="navbar-inner">
                <ul class="nav pull-right">
                    <li id="fat-menu" class="dropdown">
                        <a href="#" role="button" class="dropdown-toggle" data-toggle="dropdown">
                            <i class="icon-user"></i> Susana 
                            <i class="icon-caret-down"></i>
                        </a>
                        <ul class="dropdown-menu">
                            <li><a tabindex="-1" class="visible-phone" href="#">Settings</a></li>
                            <li class="divider visible-phone"></li>
                            <li><a tabindex="-1" href="sign-in.html">Logout</a></li>
                        </ul>
                    </li>
                </ul>
                <a class="brand" href="http://localhost/Modulo_Admin/AdminController"><span class="first">M&oacute;dulo</span> <span class="second">Administrador</span></a>
            </div>
        </div>

        <div class="sidebar-nav">
            <a href="#pacientes-menu" onclick="window.location = 'http://localhost/Modulo_Admin/AdminController';" class="nav-header" data-toggle="collapse"><i class="icon-dashboard"></i>Pacientes</a>
            <a href="#personal-menu" class="nav-header" data-toggle="collapse"><i class="icon-briefcase"></i>Personal <i class="icon-chevron-up"></i></a>
            <ul id="personal-menu" class="nav nav-list collapse">
                <li><a href="#" onclick="window.location = 'http://localhost/Modulo_Admin/AdminController/page/2';" >Doctores</a></li>
                <li><a href="#" onclick="window.location = 'http://localhost/Modulo_Admin/AdminController/page/4';" >Recepcionistas</a></li>
            </ul>
            <a href="#reportes-menu" onclick="window.location = 'http://localhost/Modulo_Admin/Reportes';" class="nav-header collapsed" data-toggle="collapse"><i class="icon-exclamation-sign"></i>Reportes </a>
            <a href="#configuracion-menu" class="nav-header" data-toggle="collapse"><i class="icon-legal"></i>Configuraciones <i class="icon-chevron-up"></i></a>
            <ul id="configuracion-menu" class="nav nav-list collapse">
                <li ><a href="#" onclick="window.location = '<?php echo base_url(); ?>AdminController/page/6';">Especialidades</a></li>
                <li ><a href="#" onclick="window.location = '<?php echo base_url(); ?>AdminController/page/7';">Parámetros</a></li>
            </ul>
        </div>

        <div class="content">
            <div class="header">
                <h1 class="page-title">Par&aacute;metros de Configuraci&oacute;n</h1>
            </div>
            <fieldset class="container-fluid">
                <legend> Informaci&oacute;n del Centro de Salud: <?php echo $clinic['nombre_comercial']; ?></legend>
                <form class="form-inline">
                    <table width="70%">
                        <tr style="height: 40px">
                            <td>Raz&oacute;n Social : </td>
                            <td><?php echo $clinic['razon_social']; ?></td>
                        </tr>
                        <tr style="height: 40px">
                            <td>RUC : </td>
                            <td><?php echo $clinic['ruc']; ?></td>
                        </tr>    
                        <tr style="height: 40px"> 
                            <td>Direcci&oacute;n : </td>
                            <td><?php echo $clinic['direccion']; ?></td>
                        </tr>
                        <tr style="height: 40px"> 
                            <td>Horario de atenci&oacute;n : </td>
                            <td><?php echo $clinic['hora_inicio_atencion']; ?> - <?php echo $clinic['hora_fin_atencion']; ?></td>
                        </tr>
                        <tr style="height: 40px">
                            <td>El paciente puede reservar una cita con una anticipaci&oacute;n m&aacute;xima de : </td>
                            <td><?php echo $clinic['dias_max_reserva']; ?> días</td>
                        </tr>
                        <tr style="height: 40px">
                            <td>El paciente puede reservar una cita con una anticipaci&oacute;n m&iacute;nima de : </td>
                            <td><?php echo $clinic['dias_min_reserva']; ?> días</td>
                        </tr>
                        <tr style="height: 40px">
                            <td>Una cita se puede cancelar con una anticipación m&aacute;xima de :</td>
                            <td><?php echo $clinic['dias_max_cancelacion']; ?> días</td>
                        </tr>
                        <tr style="height: 40px">
                            <td></td>
                            <td><a href="#editClinicModal" role="button" data-toggle="modal">
                                    <button class="btn" onclick=""><i class="icon-pencil"></i> Editar</button></a>
                            </td>
                        </tr>
                    </table>
                </form>
                <?php if ($message != null) { ?>
                    <table width="70%">
                        <tr style="height: 40px">
                            <td style="color: red"><?php echo $message; ?></td>
                        </tr>
                    </table>
                <?php } ?>
            </fieldset>
        </div>

        <div class="modal small hide fade" id="editClinicModal" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <!-- Modal para editar los parámetros del Centro de Salud -->
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">X</button>
                <h3 id="myModalLabel">Centro de Salud: <?php echo $clinic['nombre_comercial']; ?></h3>
            </div>
            <div class="modal-body" style="padding:15px;">
                <form id="form_edit_clinic" action="<?php echo base_url(); ?>AdminController/updateParameters" method="POST">
                    <table style="height: 40px;width: 100%">
                        <tr>
                            <td>Horario de atenci&oacute;n:   
                                <select name="startTime" onchange="check_start_time();" id="startTime" class="input-small">
                                    <?php for ($i = 5; $i <= 22; $i++) { ?>
                                        <option value="<?php echo $i; ?>" <?php if ($i == $startTimeCombo) { ?> selected <?php } ?>><?php echo $i . ':00'; ?></option>
                                    <?php } ?>
                                </select>  -  
                                <select name="endTime" onchange="check_end_time();" id="endTime" class="input-small">
                                    <?php for ($i = 6; $i <= 23; $i++) { ?>
                                        <option value="<?php echo $i; ?>" <?php if ($i == $endTimeCombo) { ?> selected <?php } ?>><?php echo $i . ':00'; ?></option>
                                    <?php } ?>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td>Tiempo m&aacute;ximo para reservar una cita: 
                                <select name="maxTimeReserv" id="maxTimeReserv" class="input-small">
                                    <?php for ($i = 1; $i <= 12; $i++) { ?>
                                        <option value="<?php echo $i * 15; ?>" <?php if ($i * 15 == $clinic['dias_max_reserva']) { ?> selected <?php } ?>><?php echo $i * 15; ?></option>
                                    <?php } ?>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td>Tiempo m&iacute;nimo para reservar una cita: 
                                <select name="minTimeReserv" id="minTimeReserv" class="input-small">
                                    <?php for ($i = 1; $i <= 5; $i++) { ?>
                                        <option value="<?php echo $i; ?>" <?php if ($i == $clinic['dias_min_reserva']) { ?> selected <?php } ?>><?php echo $i; ?></option>
                                    <?php } ?>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td>Tiempo m&aacute;ximo para cancelar una cita: 
                                <select name="maxTimeCancel" id="maxTimeCancel" class="input-small">
                                    <?php for ($i = 1; $i <= 5; $i++) { ?>
                                        <option value="<?php echo $i; ?>" <?php if ($i == $clinic['dias_max_cancelacion']) { ?> selected <?php } ?>><?php echo $i; ?></option>
                                    <?php } ?>
                                </select>
                            </td>
                        </tr>
                    </table>
                </form>
            </div>
            <div class="modal-footer">
                <button class="btn" data-dismiss="modal" aria-hidden="true"><i class="icon-arrow-left"></i> Atrás</button>
                <button class="btn btn-danger" data-dismiss="modal" onclick="$('#form_edit_clinic').submit();"><i class="icon-save"></i> Guardar</button>
            </div>
        </div>
    </div>

    <script src="<?php echo base_url(); ?>js/bootstrap/js/bootstrap.js"></script>
    <script>
            $("[rel=tooltip]").tooltip();
            function check_start_time() {
                var startTime = parseInt($("#startTime").val());
                var endTime = parseInt($("#endTime").val());
                if (startTime >= endTime) {
                    endTime = startTime + 1;
                    $("#endTime").val(endTime);
                }
            }
            function check_end_time() {
                var startTime = parseInt($("#startTime").val());
                var endTime = parseInt($("#endTime").val());
                if (endTime <= startTime) {
                    startTime = endTime - 1;
                    $("#startTime").val(startTime);
                }
            }
    </script>
</body>
</html>